<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //创建一个猪构造函数
        function Pig(uname, age){
            //第一个uname是属性 第二个uname是实参
            this.uname = uname
            this.age = age
        }
        //console.log(new Pig('佩奇', 6))
        //console.log(new Pig('乔治', 3))
        const p = new Pig('佩奇', 6)
        console.log(p)

        //const pepa = {uname: '佩奇', age: 6}

        function Goods(name, price, count){
            this.name = name
            this.price = price
            this.count = count
        }
        const mi = new Goods('小米', 1999, 20)
        console.log(mi)
    </script>
</body>
</html>